from  selenium import  webdriver
driver=webdriver.Chrome()
driver.get('https://www.51job.com/')
driver.implicitly_wait(10)
#输入python
driver.find_element_by_css_selector('#kwdselectid:nth-child(1)').send_keys('python')
#点击加按钮
driver.find_element_by_css_selector('#work_position_input:nth-child(1)').click()
#点击确认按钮保留选择城市
driver.find_element_by_id('work_position_click_bottom_save').click()
driver.find_element_by_css_selector('span[class="p_but"]').click()

#点击搜索按钮
suosou=driver.find_element_by_css_selector('div button:nth-child(2)').click()
#获取所有的发布岗位信息
ele1 = driver.find_elements_by_css_selector('#resultList div[class="el"]')

#历遍选择好的所有的岗位
for eles in ele1:
    #根据tag选择岗位信息
    zhaosheng=eles.find_elements_by_tag_name('span')
    jieguo = [list.text for list in zhaosheng]
    print('|'.join(jieguo))

print('''
***************************************第二页内容*************************************
                                                                                  ''')
#点击第二页
button2 =driver.find_element_by_css_selector('.p_in li:nth-child(8)').click()
#获取第二页发布岗位信息
ele2 = driver.find_elements_by_css_selector('#resultList div[class="el"]')

#历遍第二页选择好的所有的岗位
for eles2 in ele2:
    zhaosheng2 = eles2.find_elements_by_tag_name('span')
    jieguo2 = [list2.text for list2 in zhaosheng2]
    print('||'.join(jieguo2))
driver.quit()